package cn.daichi.wxpayment.vo;

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class R {

    // 响应码
    private Integer code;
    // 响应消息
    private String message;
    // 响应数据
    private Map<String, Object> data = new HashMap<>();

    public R(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static R ok() {
        return new R(0, "成功");
    }

    public static R error() {
        return new R(-1, "失败");
    }

    public R data(String key, Object data) {
        this.data.put(key, data);
        return this;
    }

}
